import { PropType, ExtractPropTypes } from 'vue';
import { createPropsResolver } from '../../dynamic-resolver';
import easyTransferSchema from './schema/easy-transfer.schema.json';
import { schemaMapper } from './schema/schema-mapper';

export const easyTransferProps = {
    id:{type: String},
    /**
     * @description 数据源
     */
    dataSource: { type: Array<object>, default: [] },
    /**
     * @description 展示类型
     */
    displayType: { type: String, default: 'List' },
    /**
     * @description 启用搜索
     */
    enableSearch: { type: Boolean, default: true },
    /**
     * @description 唯一标识字段
     */
    identifyField: { type: String, default: 'id' },
    /**
     * @description 默认占位符
     */
    placeholder: { type: String, default: '' },
    /**
     * @description 默认选中项
     */
    selections: { type: Array<object>, default: [] },
    /**
     * @description 默认选中项的值
     */
    selectionValues: { type: Array<string>, default: [] }
} as Record<string, any>;

export type EasyTransferProps = ExtractPropTypes<typeof easyTransferProps>;

export const propsResolver = createPropsResolver<EasyTransferProps>(easyTransferProps, easyTransferSchema, schemaMapper);
